/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2025-07-09
 * Time: 18:18
 */
public class test1 {
    public int maxDepth(TreeNode root) {
        if(root==null){
            return 0;
        }
        int left = maxDepth(root.left);
        int right = maxDepth(root.right);
        return Math.max(left,right)+1;
    }

    class TreeNode{
        TreeNode left;
        TreeNode right;

        public TreeNode(TreeNode left,TreeNode right){
            this.left = left;
            this.right = right;
        }
    }
}
